var column = [
        { text: 'Name', dataIndex: 'name' },
        { text: 'Email', dataIndex: 'email', flex: 1 },
        { text: 'Phone', dataIndex: 'phone' }
    ];

Ext.create('Ext.data.Store', {
    storeId: 'simpsonsStore',
    fields:[ 'name', 'email', 'phone'],
    data: [
        { name: 'Lisa', email: 'lisa@simpsons.com', phone: '555-111-1224' },
        { name: 'Bart', email: 'bart@simpsons.com', phone: '555-222-1234' },
        { name: 'Homer', email: 'homer@simpsons.com', phone: '555-222-1244' },
        { name: 'Marge', email: 'marge@simpsons.com', phone: '555-222-1254' }
    ]
});



Ext.onReady(function(){
	Ext.define('gird-demo',{
		extend:'Ext.grid.Panel',
		columns:column,
		selModel: {
			selType: 'checkboxmodel'
		},
		store:Ext.data.StoreManager.lookup('simpsonsStore')
	});
	Ext.define('grid-Demo',{
		extend:'Ext.window.Window',
		width:500,
		height:300,
		autoShow:true,
		tbar:[{
			xtype:'button',
			text:'delete',
			handler:function(){
				//var gird-demo = Ext.create('gird-demo')
				//alert(Ext.getCmp('selectID').translatePoints(1));
			}
		}],
		items:[{
			xtype:'gridpanel',
			id:'selectID',
			columns:column,
			selModel: {
				selType: 'checkboxmodel'
			},
			store:Ext.data.StoreManager.lookup('simpsonsStore'),
			tbar:[{
				xtype:'button',
				text:'Add',
				handler:function(){
					var name ; 
					var grid = this.up('gridpanel');
					var select = grid.getSelectionModel( ).getSelection();
					if(select==0){
						alert('Please Select One Row!');
					}else{
						var  record = select[0];
						alert(record.get('name'))
					}
				}	
			},'->',{
				xtype:'button',
				text:'Close',
				iconCls:'close'
			}]
			
		}],
		renderTo:Ext.getBody()
	});
	var grid =  Ext.create('grid-Demo');

	grid.show();
});